package com.zzxx.www.service.impl;

import com.zzxx.www.dao.impl.LoginDaoImpl;
import com.zzxx.www.domain.Admin;
import com.zzxx.www.domain.User;
import com.zzxx.www.service.LoginService;
import com.zzxx.www.utils.LoginException;

public class LoginServiceImpl implements LoginService {
	private LoginDaoImpl loginDao = new LoginDaoImpl();
	@Override
	public Admin login(String loginname, String password) throws LoginException {
		try {
			Admin admin = loginDao.login(loginname);
			if (admin.getPassword().equals(password)) return admin;
			else throw new LoginException("密码错误");
		} catch (LoginException e) {
			throw e;
		}
	}
}
